package org.example;

import org.example.GUI;

import java.io.*;
import java.net.Socket;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class TCPClient {


    public static void main(String[] args) throws IOException {

        String url = "jdbc:mysql://localhost:3306/chess";
        String user = "root";
        String password = "abc123";

        try {
            Connection connection = DriverManager.getConnection(url, user, password);
            Socket socket = new Socket("127.0.0.1", 8888);
            ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
            ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
            // 连接成功
            System.out.println("连接成功");
            GUI hall=new GUI(connection,oos,ois,socket);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


}